<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>点标记添加点击事件</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <style>
    body,
    html,
    #container {
      overflow: hidden;
      width: 100%;
      height: 100%;
      margin: 0;
      font-family: "微软雅黑";
    }
  </style>
  <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=NsiMq2o0Clstl9Ktz80HIuNLF7zI4qcV"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script>
  var map = new BMapGL.Map('container');
  var point = new BMapGL.Point(116.404, 39.925);
  map.centerAndZoom(point, 15);
  map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
  var scaleCtrl = new BMapGL.ScaleControl();  // 添加比例尺控件
  map.addControl(scaleCtrl);
  var zoomCtrl = new BMapGL.ZoomControl();  // 添加缩放控件
  map.addControl(zoomCtrl);
  // 创建点标记
  var marker = new BMapGL.Marker(point);
  map.addOverlay(marker);
  // 创建信息窗口
  var opts = {
    width: 200,
    height: 100,
    title: '故宫博物院'
  };
  var infoWindow = new BMapGL.InfoWindow('地址：北京市东城区王府井大街88号乐天银泰百货八层', opts);
  // 点标记添加点击事件
  marker.addEventListener('click', function () {
    map.openInfoWindow(infoWindow, point); // 开启信息窗口
  });
</script>